package translationModels;

import java.util.ArrayList;

public class TParam
{
	public final String f;
	public final String e;
	
	public TParam(String f, String e)
	{
		if (f == null)
			throw new IllegalArgumentException("f cannot be null");
		this.f = f;
		this.e = e;
	}
	
	@Override
	public int hashCode() {
		if (e == null)
			return f.hashCode();
		return f.hashCode() ^ e.hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof TParam))
			return false;
		TParam casted = (TParam)obj;
		if (this.e == null)
			return ((this.f.equals(casted.f)) && (casted.e == null));
		return ((this.f.equals(casted.f)) && (this.e.equals(casted.e)));
	}
	
	public ArrayList<String> toArrayList()
	{
		ArrayList<String> list = new ArrayList<String>();
		list.add(f);
		list.add(e);
		return list;
	}
}
